package com.chris.core.socket.netty.service.http;

import com.chris.core.socket.netty.dto.SocketTypeEnum;
import com.chris.core.socket.netty.handler.NettyHttpHandler;
import com.chris.core.socket.netty.util.NettyServerUtil;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.http.HttpServerCodec;

/**
 * netty http 服务器
 */
//@Service
public class NettyHttpServerService {
    NettyServerUtil NettyServer  = new NettyServerUtil(10103,180000,"\r\n", SocketTypeEnum.StringSocket) {
        @Override
        public void AddChannelHandler(ChannelPipeline pipeline) {
            //http 编码解码器
            pipeline.addLast(new HttpServerCodec());
            pipeline.addLast(new NettyHttpHandler());
        }
    };

    public NettyHttpServerService() throws InterruptedException {

        NettyServer.Open();
    }
}
